package com.woniuxy.service.impl;

import com.woniuxy.entity.Admin;
import com.woniuxy.entity.AdminExample;
import com.woniuxy.mapper.AdminMapper;
import com.woniuxy.service.AdminService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
    @Resource
    private AdminMapper adminMapper;

    @Override
    public Admin selectByNameOrTel(String name) throws Exception {
//        AdminExample example = new AdminExample();
//        AdminExample.Criteria criteria = example.createCriteria();
//        criteria.andTelEqualTo(name);
//        example.or(criteria.andNameEqualTo(name));
//        List<Admin> list = adminMapper.selectByExample(example);
//        return  list!=null&list.size()>0?list.get(0):null;
        return adminMapper.selectAdminByNameOrTel(name);
    }
}
